package com.bryantkobe.myspringcode.controller;

import com.bryantkobe.myspringcode.service.MRedisService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: Redis相关Controller
 * @author: alienwarezzl
 * @date: 2025/9/21
 */
@RestController
@RequestMapping("/redis")
@Tag(name = "Redis模块",description = "用于测试Redis模块")
public class RedisController {

    @Resource
    private MRedisService redisService;

    @Operation(summary = "setRedisValue",description = "设置redis值")
    @PostMapping("/setRedisValue")
    public void setRedisValue(String key,String value) {
        redisService.set(key, value);
    }

    @Operation(summary = "getByKey",description = "根据KEY获取value")
    @PostMapping("/getByKey")
    public Object getByKey(String key){
        return redisService.get(key);
    }
}
